package zhuyun.code.launcheractivity.view

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.provider.SyncStateContract
import zhuyun.code.launcheractivity.model.Constants
import zhuyun.code.launcheractivity.utils.SPUtils

class LauncherActivity : BaseActivity() {
    private val mHandler = Handler()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val isFirstIn = SPUtils.getBoolean(Constants.IS_FIRST_IN,true)
        val isLogin = SPUtils.getUserBoolean(Constants.IS_LOGIN,false)
        mHandler.postDelayed(Runnable {
            startActivity(if(isFirstIn) GuidePageActivity::class.java else if(isLogin) MainActivity::class.java else LoginActivity::class.java)
            finish()
        },1000)

    }

    override fun onDestroy() {
        super.onDestroy()
        mHandler.removeCallbacksAndMessages(null)
    }
}
